package com.by.facade.enums.clue;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/4/3 2:44 PM
 */
@AllArgsConstructor
@Getter
public enum TradeStatusEsEnum {

    UN_PAY(TradeStatusEsEnum.UN_PAY_CODE, "未支付"),
    PARTY_PAY(TradeStatusEsEnum.PARTY_PAY_CODE, "部分支付"),
    COMPLETE_ORDER(TradeStatusEsEnum.COMPLETE_ORDER_CODE, "已支付"),
    ;
    private final Integer status;
    private final String desc;

    public static final Map<Integer, TradeStatusEsEnum> MAP;

    static {
        MAP = Stream.of(TradeStatusEsEnum.values()).collect(Collectors.toMap(TradeStatusEsEnum::getStatus, Function.identity()));
    }

    public static TradeStatusEsEnum resolveByStatus(Integer status) {
        return MAP.get(status);
    }

    public static final int UN_PAY_CODE = 1;
    public static final int PARTY_PAY_CODE = 2;
    public static final int COMPLETE_ORDER_CODE = 3;
}
